package com.xique.park.service.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xique.common.core.utils.StringUtils;
import com.xique.park.bean.domain.ParkUnlicensedCar;
import com.xique.park.bean.search.h5.ParkUnlicensedCarListSearch;
import com.xique.park.mapper.ParkUnlicensedCarMapper;
import com.xique.park.service.service.IParkUnlicensedCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shd
 * @create 2022/6/29 11:20
 */
@Service
public class ParkUnlicensedCarServiceImpl extends ServiceImpl<ParkUnlicensedCarMapper, ParkUnlicensedCar> implements IParkUnlicensedCarService {

    @Autowired
    private ParkUnlicensedCarMapper parkUnlicensedCarMapper;

    @Override
    public List<ParkUnlicensedCar> list(ParkUnlicensedCarListSearch search) {
        LambdaQueryWrapper<ParkUnlicensedCar> condition = Wrappers.lambdaQuery();
        condition.eq(StringUtils.isNotEmpty(search.getPlate()), ParkUnlicensedCar::getPlate, search.getPlate());
        condition.eq(search.getBaseUserId() != null, ParkUnlicensedCar::getBaseUserId, search.getBaseUserId());
        return parkUnlicensedCarMapper.selectList(condition);
    }
}
